package com.briup.shopadmin.web.controller;

import com.briup.shopadmin.common.Result;
import com.briup.shopadmin.service.IIndexService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Api(tags="首⻚数据相关接口")
@RestController
@RequestMapping("index")
public class IndexController {
    @Autowired
    IIndexService indexService;

    @GetMapping("dashboard")
    @ApiOperation("首⻚仪表盘数据")
    public Result dashboard(){
        Map<String, Long> map = indexService.dashboard();
        return  Result.success(map);

    }
    @ApiOperation("会员性别比例图")
    @GetMapping("sexRatio")
    public Result sexRatio(){
        Map<String, Double> map = indexService.sexRatio();
        return  Result.success(map);
    }
    @ApiOperation("商品分类统计")
    @GetMapping("categoryStats")
    public Result categoryStats(){
        Map<String, String> map = indexService.categoryStats();
        return Result.success(map);

    }
}
